<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>Docs For Class Handler</title>
			<link rel="stylesheet" href="../../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
			<div class="page-body">			
<h2 class="class-name">Class Handler</h2>

<a name="sec-description"></a>
<div class="info-box">
	<div class="info-box-title">Description</div>
	<div class="nav-bar">
					<span class="disabled">Description</span> |
													<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
						|											<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
						
					</div>
	<div class="info-box-body">
        		<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Event handlers listen to events from specific types of class. Upon construction,</p>
<p class="description"><p>the names of the classes the handler listens to should be provided, e.g.:  <div class="src-code"><ol><li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id">Event_Handler</span><span class="src-sym">(</span><span class="src-str">'Class_A'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'Class_B'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'Class_C'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
</ol></div>  creates a new handler that can respond to each event triggered by classes Class_A,  Class_B or Class_C. Also, it will respond to any classes extending these. Besides  classnames, you can also create handlers specifying them to listen to interfaces;  this has them respond to each class that implements them (and their children):  <div class="src-code"><ol><li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id">Event_Handler</span><span class="src-sym">(</span><span class="src-str">'Interface_A'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
</ol></div>  Multiple handlers can be registered to listen to the same classes. Each of them  will be notified when an event is triggered.  <div class="src-code"><ol><li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id">Event_Handler</span><span class="src-sym">(</span><span class="src-str">'Class_A'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id">Other_Handler</span><span class="src-sym">(</span><span class="src-str">'Class_A'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
</ol></div></p><p>By default, no event originating from the classes and interfaces under  consideration is responded to. In order to act on an event, handlers should  implement methods (at least protected) based on the type of the event it wants to  respond to. The event-type is camel-cased and prefixed by &quot;on&quot;:  Event\Event(&quot;before-delete&quot;) will trigger the method  &quot;onBeforeDelete(Event\Event $oEvent)&quot; in the handler.</p><p>Events that have no corresponding methods will do nothing.</p><p>In any Event_Handler-&gt;onEventType(Event\Event $oEvent) the triggering class  instance can be retrieved by calling $oEvent-&gt;getSource()  Event\Event::getSource(), as well as a number of other values.</p><p>An event handler may raise the prevent-default flag by calling  Event\Event::preventDefault(). The triggering method can then check this  flag and decide whether or not to proceed Event\Event.</p></p>
	<ul class="tags">
				<li><span class="field">author:</span> Gerrit Jan van Ahee &lt;<a href="mailto:gerrit.jan@yes2web.nl">gerrit.jan@yes2web.nl</a>&gt;</li>
				<li><span class="field">version:</span> SVN: $Id$</li>
				<li><span class="field">copyright:</span> 2010-2011 Yes2web B.V.</li>
				<li><span class="field">see:</span> Event\Event</li>
				<li><span class="field">link:</span> www.yes2web.nl</li>
				<li><span class="field">license:</span> <a href="http://www.php.net/license/3_01.txt">PHP License 3.01</a></li>
			</ul>
		<p class="notes">
			Located in <a class="field" href="_handler.class.php.html">/handler.class.php</a> (line <span class="field">61</span>)
		</p>
		
				
		<pre></pre>
	
			</div>
</div>



	<a name="sec-var-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Variable Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
						<span class="disabled">Vars</span> (<a href="#sec-vars">details</a>)
							| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
								</div>
		<div class="info-box-body">
			<div class="var-summary">
																								<div class="var-title">
					<span class="var-type">String[]</span>
					<a href="#$asHandlerFor" title="details" class="var-name">$asHandlerFor</a>
				</div>
											</div>
		</div>
	</div>

	<a name="sec-method-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Method Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
																		<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
				 
				|
						<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
		</div>
		<div class="info-box-body">			
			<div class="method-summary">
																																				<div class="method-definition">
					static 						<span class="method-result">null</span>
										<a href="#register" title="details" class="method-name">register</a>
											(<span class="var-type"><a href="../../event/event/Handler.html">Handler</a></span>&nbsp;<span class="var-name">$oHandler</span>)
									</div>
																<div class="method-definition">
					static 						<span class="method-result">Mixed[]</span>
										<a href="#signalEvent" title="details" class="method-name">signalEvent</a>
											(<span class="var-type"><a href="../../event/event/Event.html">Event</a></span>&nbsp;<span class="var-name">$oEvent</span>)
									</div>
																
												<div class="method-definition">
											<span class="method-result">Handler</span>
										<a href="#__construct" title="details" class="method-name">__construct</a>
											(<span class="var-type">String</span>&nbsp;<span class="var-name">$sDispatcherClassName</span>)
									</div>
																<div class="method-definition">
											<span class="method-result">String</span>
										<a href="#getEventHandle" title="details" class="method-name">getEventHandle</a>
											(<span class="var-type"><a href="../../event/event/Event.html">Event</a></span>&nbsp;<span class="var-name">$oEvent</span>)
									</div>
																<div class="method-definition">
											<span class="method-result">Mixed</span>
										<a href="#handleEvent" title="details" class="method-name">handleEvent</a>
											(<span class="var-type"><a href="../../event/event/Event.html">Event</a></span>&nbsp;<span class="var-name">$oEvent</span>)
									</div>
																																<div class="method-definition">
											<span class="method-result">null</span>
										<a href="#__call" title="details" class="method-name">__call</a>
											(<span class="var-type">String</span>&nbsp;<span class="var-name">$sHandle</span>, <span class="var-type"></span>&nbsp;<span class="var-name">$amArgv</span>)
									</div>
								</div>
		</div>
	</div>		

	<a name="sec-vars"></a>
	<div class="info-box">
		<div class="info-box-title">Variables</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
										<a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>)
						
			
										| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
					</div>
		<div class="info-box-body">
			<a name="var$asHandlerFor" id="$asHandlerFor"><!-- --></A>
<div class="evenrow">

	<div class="var-header">
		<span class="var-title">
			<span class="var-type">String[]</span>
			<span class="var-name">$asHandlerFor</span>
			 = <span class="var-default">array()</span>			(line <span class="line-number">99</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
	<ul class="tags">
				<li><span class="field">var:</span> list of class names of classes this handler responds to</li>
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	
		
		

</div>
						
		</div>
	</div>
	
	<a name="sec-methods"></a>
	<div class="info-box">
		<div class="info-box-title">Methods</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
															<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
																	<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
						
		</div>
		<div class="info-box-body">
			<A NAME='method_detail'></A>
<a name="methodregister" id="register"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">static method register</span> (line <span class="line-number">76</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Registers handelrs that will be informed by Events</p>
	<ul class="tags">
				<li><span class="field">see:</span> <a href="../../event/event/Handler.html#method__construct">Handler::__construct()</a></li>
				<li><span class="field">see:</span> singalEvent()</li>
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	<div class="method-signature">
	    static
		<span class="method-result">null</span>
		<span class="method-name">
			register
		</span>
					(<span class="var-type"><a href="../../event/event/Handler.html">Handler</a></span>&nbsp;<span class="var-name">$oHandler</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">Event\Handler</span>
				<span class="var-name">$oHandler</span><span class="var-description">: the handler to register</span>			</li>
				</ul>
		
			
	</div>
<a name="methodsignalEvent" id="signalEvent"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">static method signalEvent</span> (line <span class="line-number">88</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Signal all handlers of an event</p>
	<ul class="tags">
				<li><span class="field">return:</span> list of returned values from the event handlers</li>
				<li><span class="field">see:</span> Event\Event::__construct()</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
	    static
		<span class="method-result">Mixed[]</span>
		<span class="method-name">
			signalEvent
		</span>
					(<span class="var-type"><a href="../../event/event/Event.html">Event</a></span>&nbsp;<span class="var-name">$oEvent</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">Event\Event</span>
				<span class="var-name">$oEvent</span><span class="var-description">: the Event triggered</span>			</li>
				</ul>
		
			
	</div>

<a name="method__construct" id="__construct"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">Constructor __construct</span> (line <span class="line-number">109</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Construct a new Event\Handler to listen to classes with the provided names.</p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">Handler</span>
		<span class="method-name">
			__construct
		</span>
					(<span class="var-type">String</span>&nbsp;<span class="var-name">$sDispatcherClassName</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">String</span>
				<span class="var-name">$sDispatcherClassName</span><span class="var-description">: class name of object to resopnd to, should  be at least one, but may be more.</span>			</li>
				</ul>
		
			
	</div>
<a name="methodgetEventHandle" id="getEventHandle"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">getEventHandle</span> (line <span class="line-number">125</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get the handle of the event received, i.e. which method should handle Events  of this type.</p>
	<ul class="tags">
				<li><span class="field">return:</span> The handle to which a Handler should bind</li>
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">String</span>
		<span class="method-name">
			getEventHandle
		</span>
					(<span class="var-type"><a href="../../event/event/Event.html">Event</a></span>&nbsp;<span class="var-name">$oEvent</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type"><a href="../../event/event/Event.html">Event</a></span>
				<span class="var-name">$oEvent</span>			</li>
				</ul>
		
			
	</div>
<a name="methodhandleEvent" id="handleEvent"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">handleEvent</span> (line <span class="line-number">140</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Check whether the event originates from an instance that is of the type of one  of the dispatcher types that this handler has been bound to.</p>
	<ul class="tags">
				<li><span class="field">return:</span> whatever the handling method returns</li>
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">Mixed</span>
		<span class="method-name">
			handleEvent
		</span>
					(<span class="var-type"><a href="../../event/event/Event.html">Event</a></span>&nbsp;<span class="var-name">$oEvent</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">Event\Event</span>
				<span class="var-name">$oEvent</span><span class="var-description">: the event triggered</span>			</li>
				</ul>
		
			
	</div>
<a name="method__call" id="__call"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">__call</span> (line <span class="line-number">169</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">A handler may not need to handle ALL events dispatched by a source. This  method will make sure that nothing crashes when an event is not handled, e.g.</p>
<p class="description"><p>when new events are added to the source or events just not need to be handled  in the first place.</p></p>
	<ul class="tags">
				<li><span class="field">return:</span> as this handler is apparentely not required</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">null</span>
		<span class="method-name">
			__call
		</span>
					(<span class="var-type">String</span>&nbsp;<span class="var-name">$sHandle</span>, <span class="var-type"></span>&nbsp;<span class="var-name">$amArgv</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">String</span>
				<span class="var-name">$sHandle</span><span class="var-description">: name of the method intended</span>			</li>
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$amArgv</span><span class="var-description">: params provided to it</span>			</li>
				</ul>
		
			
	</div>
						
		</div>
	</div>


	<p class="notes" id="credit">
		Documentation generated on Fri, 28 Jan 2011 19:36:50 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.3</a>
	</p>
	</div></body>
</html>